package com.lloydfinch.ldlayer.dao;

import com.lloydfinch.bblayer.UserBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 插在UserDao和Logic Layer之间，执行符合操作
 */
public class UserDaoHelper implements IUserDao {

    private UserDao userDao = new UserDao();

    @Override
    public UserBean getUser(String id) {
        return userDao.getUser(id);
    }

    @Override
    public void storeUser(UserBean user) {

    }

    @Override
    public void storeUsers(List<UserBean> users) {

    }

    @Override
    public List<UserBean> getAllVipUser() {
        // TODO 这里模拟一个符合操作
        List<UserBean> users = userDao.getUsers();
        List<UserBean> vipUsers = new ArrayList<>();
        for (UserBean user : users) if (user.vip) vipUsers.add(user);

        return vipUsers;
    }
}
